package edu.gatech.wms.models;

import java.util.ArrayList;
import java.util.List;


public class User
{
	private String firstName, lastName, contact, password;
	private boolean isAdmin,isLocked;
	private int userId, loginTries;
	private List<Integer> itemsOwned;

	public User( String _firstName, String _lastName, int id, String _password, String _contact, boolean _admin )
	{
		userId = id;
		firstName = _firstName;
		lastName = _lastName;
		password = _password;
		contact = _contact;
		isAdmin = _admin;
		loginTries = 0;
		isLocked = false;
		itemsOwned = new ArrayList<Integer>();
	}
	
	public void addOwnedItem(int _itemId) {
		itemsOwned.add(_itemId);
	}
	
	public void removeOwnedItem(Item item) {
		itemsOwned.remove(item.getId());
	}
	
	public List<Integer> getItemsList() {
		return itemsOwned;
	}
	
	public String getFirstName()
	{
		return firstName;
	}
	
	public void setFirstName(String s)
	{
		firstName = s;
	}
	
	public String getLastName()
	{
		return lastName;
	}
	
	public void setLastName(String s)
	{
		lastName = s;
	}
	
	public String getPassword()
	{
		return password;
	}
	
	public void setPassword(String _newpass) 
	{
		password = _newpass;
	}
	
	public String getContact()
	{
		return contact;
	}
	
	public void setContact(String s)
	{
		contact = s;
	}
	
	public boolean getAdmin()
	{
		return isAdmin;
	}
	

	public void setAdmin(boolean b)
	{
		isAdmin = b;
	}
	
	public int getId()
	{
		return userId;
	}
	
	/**
	 * increment login attempts by 1
	 */
	public void incrementLockout() {
		loginTries++;
	}
	/**
	 * reset login attempts to 0
	 */
	public void resetLockout() {
		loginTries = 0;
		isLocked = false;
	}
	
	public boolean getLockedStatus() {
		return isLocked;
	}
	
	public void setLockedStatus(boolean _status) {
		isLocked = _status;
	}
	
	public int getTryCount() {
		return loginTries;
	}

	
	
}
